﻿using SD.Infrastructure.AppServiceBase;
using SD.Infrastructure.DTOBase;
using SD.OpcServer.IAppService.DTOs;
using System;
using System.Collections.Generic;
using System.ServiceModel;

namespace SD.OpcServer.IAppService.Interfaces
{
    /// <summary>
    /// OPC服务契约接口
    /// </summary>
    [ServiceContract(Namespace = "http://SD.OpcServer.IAppService.Interfaces")]
    public interface IOpcServerContract : IApplicationService
    {
        //命令部分

        #region # 创建变量 —— void CreateVariable(string variableNo, string variableName...
        /// <summary>
        /// 创建变量
        /// </summary>
        /// <param name="variableNo">变量编号</param>
        /// <param name="variableName">变量名称</param>
        /// <param name="dataType">数据类型</param>
        /// <param name="unit">单位</param>
        /// <param name="keepRecord">是否记录历史</param>
        /// <param name="equipmentNo">设备编号</param>
        /// <param name="description">描述</param>
        /// <param name="valueDescriptions">值描述字典</param>
        [OperationContract]
        void CreateVariable(string variableNo, string variableName, string dataType, string unit, bool keepRecord, string equipmentNo, string description, IDictionary<string, string> valueDescriptions);
        #endregion

        #region # 修改变量 —— void UpdateVariable(Guid variableId, string variableName...
        /// <summary>
        /// 修改变量
        /// </summary>
        /// <param name="variableId">变量Id</param>
        /// <param name="variableName">变量名称</param>
        /// <param name="unit">单位</param>
        /// <param name="keepRecord">是否记录历史</param>
        /// <param name="equipmentNo">设备编号</param>
        /// <param name="description">描述</param>
        /// <param name="valueDescriptions">值描述字典</param>
        [OperationContract]
        void UpdateVariable(Guid variableId, string variableName, string unit, bool keepRecord, string equipmentNo, string description, IDictionary<string, string> valueDescriptions);
        #endregion

        #region # 删除变量 —— void RemoveVariable(Guid variableId)
        /// <summary>
        /// 删除变量
        /// </summary>
        /// <param name="variableId">变量Id</param>
        [OperationContract]
        void RemoveVariable(Guid variableId);
        #endregion


        //查询部分

        #region # 分页获取变量列表 —— PageModel<VariableInfo> GetVariablesByPage(int pageIndex...
        /// <summary>
        /// 分页获取变量列表
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>变量列表</returns>
        [OperationContract]
        PageModel<VariableInfo> GetVariablesByPage(int pageIndex, int pageSize);
        #endregion

        #region # 根据编号获取变量字典 —— {string, VariableInfo} GetVariablesByNo(IEnumerable<string> variableNos)
        /// <summary>
        /// 根据编号获取变量字典
        /// </summary>
        /// <param name="variableNos">变量编号集</param>
        /// <returns>变量字典</returns>
        [OperationContract]
        IDictionary<string, VariableInfo> GetVariablesByNo(IEnumerable<string> variableNos);
        #endregion

        #region # 分页获取变量历史列表 —— PageModel<VariableHistoryInfo> GetVariableHistorysByPage(string variableNo...
        /// <summary>
        /// 分页获取变量历史列表
        /// </summary>
        /// <param name="variableNo">变量编号</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>变量历史列表</returns>
        [OperationContract]
        PageModel<VariableHistoryInfo> GetVariableHistorysByPage(string variableNo, DateTime? startTime, DateTime? endTime, int pageIndex, int pageSize);
        #endregion
    }
}
